<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>My Exams</title>
</head>
<body>
	<c:if test="${sessionScope.user.userType ne 'Student'}" >
		<c:redirect url="LoginServlet"></c:redirect>
	</c:if>
	<div id="header"><%@ include file="Header.jsp"%></div>
	<div id="content">
		<div id="navbar"><%@ include file="NavigationBar.jsp"%></div>
		<div id="main"><c:set var="user" value="${sessionScope.user}" />
		
			<c:set var="categories" value="${requestScope.categories}"></c:set>
			<c:set var="category" value="${requestScope.category}"></c:set>
			<c:set var="type" value="${requestScope.type}"></c:set>
		
				<div class="box">
					<div class="box-header well">
						<h2><i class=" icon-list-alt"></i> My Exams</h2>
					</div>
						<div class="box-content">
						<table
							class="table table-striped table-bordered bootstrap-datatable datatable">
							<thead>
								<tr>
									<th>Exam Name</th>
									<th>Exam Category</th>
									<th>Exam Status</th>
									<th>Date Taken</th>
									<th>Action</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach var="examResponse" items="${user.getExamResponses()}">
									<tr>
										<td>${examResponse.getExam().examName}</td>
										<td>${examResponse.getExam().category}</td>
										<c:choose>
											<c:when test="${examResponse.complete eq true}">
												<td><span class="label label-success">Taken</span></td>
												<td>${examResponse.dateTaken}</td>
												<td><a class="btn btn-info" href="StudentResponseServlet?exam_response_id=${examResponse.examResponseId}"><i class=" icon-search"></i> View Response</a></td>
											</c:when>
											<c:otherwise>
												<td><span class="label label-important">Not Yet Taken</span></td>
												<td><i class=" icon-ban-circle"></i> N/A</td>
												<td><a class="btn btn-success" href="TakeExamServlet?exam_id=${examResponse.getExam().getExamId()}"><i class="icon-edit"></i> Take Exam</a></td>
											</c:otherwise>
										</c:choose>
									</tr>
								</c:forEach>
							</tbody>
						</table>
					</div>
				</div>
	
		</div>
	</div>
</body>
</html>